# Contributor: gay <gay@disroot.org>
# Maintainer: gay <gay@disroot.org>
pkgname=darcs
pkgver=2.16.5
pkgrel=0
pkgdesc="Patch-based revision control system"
url="http://darcs.net"
arch="aarch64 x86_64" # limited by ghc
license="GPL-2.0-or-later"
makedepends="cabal ghc curl-dev ncurses-dev zlib-dev"
#checkdepends="diffutils grep lighttpd musl-locales"
options="!check" # tests relying on presence of shell utils fail without giving detailed log
subpackages="$pkgname-doc"
source="https://hackage.haskell.org/package/darcs-$pkgver/darcs-$pkgver.tar.gz
	cabal.config
	"

export CABAL_DIR="$srcdir"/cabal

prepare() {
	default_prepare
	cp "$srcdir"/cabal.config .
	cabal update
	cabal configure --prefix=/usr #--test-log=/dev/stdout
}

build() {
	cabal build --jobs=${JOBS:-1} --enable-relocatable
}

#check() {
#	ulimit -n 4096
#	cabal test
#}

package() {
	cd dist-newstyle/build/*-linux/ghc-*/$pkgname-$pkgver/build/$pkgname
	install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname
	install -Dm644 $pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1
}

sha512sums="
9116043943315417ff314197f6a143435b5545f614c6e6210c3645987a68c69c31f53f823ee5269cb663ccba393f8caf1834120783f15128e43b132c731a0edb  darcs-2.16.5.tar.gz
a54c0790e154105f3e96d19289a905b2b3666d61849ad69d6ed81b00a01ea30c7733ead989c02f1f782a95bcc7f0f2dff41ae1ffdd8eb0995fbbd5f54db232d7  cabal.config
"
